{extend name="default/base/base_home" /}
{block name="mall_main"}

<link rel="stylesheet" href="{$Think.HOME_SITE_ROOT}/css/point.css">
{include file="default/member/pointprod/pointshop_minfo" /}
<div class="dsp-container">
  
  <div class="dsp-main-layout">
    <div class="dsp-category">
        <dl class="searchbox">
            <dd><!-- 高级搜索start -->
                <ul>
                    <li>{$Think.lang.ds_sort}：</li>
                    <input type="hidden" id="orderby" name="orderby" value="{if !$Request.param.orderby}default{/if}"/>

                    <!-- 默认排序s -->
                    {if !$Request.param.orderby ||$Request.param.orderby=='default'}
                    <li class="selected">{$Think.lang.default_sort}</li>
                    {else /}
                    <li ds_type="search_orderby" data-param='{"orderval":"default"}' style="cursor: pointer;">{$Think.lang.default_sort}</li>
                    {/if}
                    <!-- 默认排序e -->

                    <!-- 积分值s -->
                    {if $Request.param.orderby == 'pointsdesc'}
                    <li class="selected" ds_type="search_orderby" data-param='{"orderval":"pointsasc"}'>{$Think.lang.integral_value}<em class=" desc"></em></li>
                    {elseif $Request.param.orderby == 'pointsasc'}
                    <li class="selected" ds_type="search_orderby" data-param='{"orderval":"pointsdesc"}'>{$Think.lang.integral_value}<em class=" asc"></em></li>
                    {else /}
                    <li ds_type="search_orderby" data-param='{"orderval":"pointsdesc"}'>{$Think.lang.integral_value}<em class=""></em></li>
                    {/if}
                    <!-- 积分值e -->

                    <!-- 上架时间s -->
                    {if $Request.param.orderby == 'stimedesc'}
                    <li class="selected" ds_type="search_orderby" data-param='{"orderval":"stimeasc"}'>{$Think.lang.shelf_time}<em class=" desc"></em></li>
                    {elseif $Request.param.orderby == 'stimeasc'}
                    <li class="selected" ds_type="search_orderby" data-param='{"orderval":"stimedesc"}'>{$Think.lang.shelf_time}<em class=" asc"></em></li>
                    {else /}
                    <li ds_type="search_orderby" data-param='{"orderval":"stimedesc"}'>{$Think.lang.shelf_time}<em class=""></em></li>
                    {/if}
                    <!-- 上架时间e -->
                    <li>&nbsp;</li>
                    <!-- 会员等级s -->
                    <li>{$Think.lang.membership_level}：
                        <select id="level" onchange="javascript:searchpointprod();">
                            <option value='' selected >{$Think.lang.ds_please_choose}</option>
                            {notempty name="membergrade_arr"}
                            {foreach name="membergrade_arr" item="v"}
                            <option value="{$v.level}" {$Request.param.level == $v['level'] ? 'selected':''}>V{$v.level}</option>
                            {/foreach}
                            {/notempty}
                        </select>
                    </li>
                    <!-- 会员等级e -->
                    <li>&nbsp;</li>
                    <!-- 所需积分s -->
                    <li>{$Think.lang.required_credits}：
                        <input type="text" id="points_min" class="text w50" value="{$Request.param.points_min}"/>
                        ~
                        <input type="text" id="points_max" class="text w50" value="{$Request.param.points_max}" />
                        <a href="javascript:searchpointprod();" class="dsp-btn">{$Think.lang.ds_search}</a> </li>
                    <!-- 所需积分e -->
                    <li>&nbsp;</li>
                    {if session('is_login') == '1'}
                    <li>
                        <label for="isable"><input type="checkbox" id="isable" {$Request.param.isable=='1' ?'checked=checked':''} onclick="javascript:searchpointprod();">
                            &nbsp;{$Think.lang.only_can_exchange_them}</label></li>
                    {/if}
                </ul>
                <!-- 高级搜索end --> 
            </dd>
        </dl>
    </div>
    {notempty name="pointprod_list"}
    <ul class="dsp-exchange-list">
        {foreach name="pointprod_list" item="v"}
        <li>
            <div class="gift-pic">
                <a href="{:url('Pointprod/pinfo',['id'=>$v.pgoods_id])}"  >
                    <img src="{$v.pgoods_image}" title="{$v.pgoods_name}" alt="{$v.pgoods_name}">
                </a>
            </div>
            <div class="exchange-rule">
                <span class="pgoods-points">{$Think.lang.points_unit}<strong>{$v.pgoods_points}</strong></span>
                <span class="pgoods-price"><em>{$Think.lang.currency}{$v.pgoods_price}</em></span>
            </div>
            <div class="gift-name">
                <a href="{:url('Pointprod/pinfo',['id'=>$v.pgoods_id])}" >{$v.pgoods_name}</a>
            </div>
            <div class="sale-num"><span class="iconfont">&#xe753;</span>{$v.pgoods_salenum}{$Think.lang.person_exchange}</div>
            <a href="{:url('Pointprod/pinfo',['id'=>$v.pgoods_id])}" class="ex-btn" target="_blank">{$Think.lang.immediate_exchange}</a>
        </li>
        {/foreach}
    </ul>
    <div class="tc mt20 mb20">
        <div class="pagination">{$show_page|raw}</div>
    </div>
    {else /}
    <div class="no_results">{$Think.lang.pointprod_list_null}</div>
    {/notempty}
  </div>
</div>
<script>
$(function () {
    $("[ds_type='search_orderby']").click(function(){
        var data_str = $(this).attr('data-param');
        eval( "data_str = "+data_str);
        $("#orderby").val(data_str.orderval);
        searchpointprod();
    });
});
function searchpointprod(){
    var url = "{:url('Pointprod/index')}"+'?';
    var orderby = $("#orderby").val();
    if(orderby){
        url += ('orderby='+orderby)+'&';
    }
    var level = $("#level").val();
    if(level){
        url += ('level='+level)+'&';
    }
    var points_min = $("#points_min").val();
    if(points_min){
        url += ('points_min='+points_min)+'&';
    }
    var points_max = $("#points_max").val();
    if(points_max){
        url += ('points_max='+points_max)+'&';
    }
    if($("#isable").attr("checked") == 'checked'){
        url += 'isable=1';
    }
    go(url);
}
</script>

{/block}
